<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书详情 - 图书管理系统</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header bg-primary text-white">
                    <h4 class="card-title mb-0">
                        <i class="fas fa-info-circle"></i> 图书详情
                    </h4>
                </div>
                <div class="card-body">
                    <!-- 图书基本信息 -->
                    <div class="row mb-4">
                        <div class="col-12">
                            <h3 class="text-center text-primary" th:text="${book.title}"></h3>
                            <p class="text-center text-muted" th:text="'作者：' + ${book.author}"></p>
                        </div>
                    </div>

                    <!-- 详细信息 -->
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <div class="card h-100">
                                <div class="card-body">
                                    <h6 class="card-title">
                                        <i class="fas fa-id-card"></i> 基本信息
                                    </h6>
                                    <table class="table table-sm table-borderless">
                                        <tr>
                                            <td><strong>ID:</strong></td>
                                            <td th:text="${book.id}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>书名:</strong></td>
                                            <td th:text="${book.title}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>作者:</strong></td>
                                            <td th:text="${book.author}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>ISBN:</strong></td>
                                            <td th:text="${book.isbn}"></td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="card h-100">
                                <div class="card-body">
                                    <h6 class="card-title">
                                        <i class="fas fa-building"></i> 出版信息
                                    </h6>
                                    <table class="table table-sm table-borderless">
                                        <tr>
                                            <td><strong>出版年份:</strong></td>
                                            <td th:text="${book.publicationYear}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>出版社:</strong></td>
                                            <td th:text="${book.publisher != null ? book.publisher : '未填写'}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>创建时间:</strong></td>
                                            <td th:text="${#temporals.format(book.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                        </tr>
                                        <tr>
                                            <td><strong>更新时间:</strong></td>
                                            <td th:text="${#temporals.format(book.updateTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 操作按钮 -->
                    <div class="row mt-4">
                        <div class="col-12 text-center">
                            <a th:href="@{/books}" class="btn btn-secondary">
                                <i class="fas fa-arrow-left"></i> 返回列表
                            </a>
                            <a th:href="@{/books/edit/{id}(id=${book.id})}" class="btn btn-warning">
                                <i class="fas fa-edit"></i> 编辑图书
                            </a>
                            <a th:href="@{/books/delete/{id}(id=${book.id})}"
                               class="btn btn-danger"
                               onclick="return confirm('确定要删除这本图书吗？')">
                                <i class="fas fa-trash"></i> 删除图书
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
</body>
</html>